package com.ma.admin.model

import org.hibernate.annotations.DynamicInsert
import org.hibernate.annotations.DynamicUpdate
import xyz.erupt.annotation.Erupt
import xyz.erupt.annotation.EruptField
import xyz.erupt.annotation.sub_field.Edit
import xyz.erupt.annotation.sub_field.EditType
import xyz.erupt.annotation.sub_field.View
import xyz.erupt.annotation.sub_field.sub_edit.InputType
import xyz.erupt.annotation.sub_field.sub_edit.Search
import java.io.Serializable
import javax.persistence.*

/**
 * 站点管理
 *
 * @author yong
 * @date 2021/2/3 14:15
 */
@Erupt(name = "站点", primaryKeyCol = "station_id")
@Table(name = "station")
@Entity
@DynamicUpdate
@DynamicInsert
class Station : Serializable {
    @EruptField
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "station_id")
    var stationId: Int? = null

    @EruptField(
            views = [View(title = "站点名称", sortable = true)],
            edit = Edit(title = "站点名称", type = EditType.INPUT, notNull = true, search = Search(), inputType = InputType())
    )
    @Column(name = "station_name")
    var stationName: String? = null

    @EruptField(
            views = [View(title = "站点所在地")],
            edit = Edit(title = "站点所在地", type = EditType.INPUT, search = Search(), inputType = InputType())
    )
    @Column(name = "station_adress")
    var stationAdress: String? = null
}